package com.incom.log.server.conf;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ResourcePropertites extends Properties {

    private static ResourcePropertites propertites = new ResourcePropertites();

    private boolean load = false;

    private ResourcePropertites() {

    }

    public static synchronized ResourcePropertites getInstance() {
        return propertites;
    }

    @Override
    public synchronized void load(InputStream inStream) throws IOException {
        if(load) {
           throw new IOException("already load resource");
        }
        super.load(inStream);
        load = !load;
    }

    public synchronized void reload(InputStream inputStream) throws IOException {
        super.load(inputStream);
        load = true;
    }
}
